package cn.wfy.proxy.handle;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.CountDownLatch;

class ProxyHandleThread extends Thread {

    private InputStream input;
    private OutputStream output;

    public ProxyHandleThread(InputStream input, OutputStream output, CountDownLatch cdl) {
        this.input = input;
        this.output = output;
    }

    public ProxyHandleThread(InputStream clientInput, OutputStream proxyOutput) {
        this.input = clientInput;
        this.output = proxyOutput;
    }

    @Override
    public void run() {
        try {
            while (true) {
                output.write(input.read());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}